# README
## "Spillovers to manufacturing plants from multi-million dollar plantations: evidence from the Indonesian palm oil boom"

Conditionally accepted at JAERE
Authors: Sebastian Kraus, Robert Heilmayr, Nicolas Koch
Programming languages/software: Stata, R, QGIS
Date of this file: 04/04/2023



## How to find regression and summary statistics code:
Excel sheet "inventory_charts-tables_scripts.xlsx" in the working directory is an inventory of all charts and tables in the paper that contains the link to the respective scripts from which they are generated. For a log of the main analysis workflow refer to "analysis/code/master_figures_tables_log.log".

For producing the final panels used for these scripts please refer to the respective section below.

## How to obtain data:
The main dataset (Indonesian manufacturing census) is confidential and thus not part of this repository. All data is specified in the separate file "data_readme.md" in the working directory.

Most other data is not licensed to be shared directly in this repository. However, it can typically be obtained for free online or from the authors.

Excel sheet "inventory_data.xlsx" describes the main data used in the analysis and how it can be procured/downloaded. Auxiliary datasets are documented in readme notes in the same folder.



## How to run the entire code including data cleaning code:
The cleaning code can be executed based on the file "cleaning_master.do".

The cleaning code contains both Stata and R scripts ands has to be run manually step-by-step.

Because of the stacked analysis the construction of the final stacked dataset takes up some resources. Stacked files are also quite large. Therefore, the stacked dataset is only generated in a temporary fashion.

For Stata: Define this working directory in a global called "opal_wd" and include it in the profile.do

For R: Run the file opal.Rproj to set up your working environment

Run scripts in the order detailed in the "cleaning_master.do"-file. For a log of this workflow refer to "cleaning_master_log.log". Logs of auxiliary R scripts can be fund in their path with analogue names.

Dependencies that cannot be installed from within the R and Stata scripts can be found in the "dependencies"-folder in the main working directory.


